//package morenoapp.model;
//
//import java.awt.Point;
//import java.awt.geom.Point2D;
//import java.util.HashSet;
//import java.util.Set;
//import morenoapp.model.data.MorenoQuestionFace;
//import morenoapp.model.data.MorenoRespondentFace;
//import morenoapp.model.impl.MorenoSociogramViewImpl;
//import morenoapp.model.view.MorenoBackgroundSociogramConfig;
//import morenoapp.model.view.MorenoCanvasSociogramConfig;
//import morenoapp.model.view.MorenoRelationshipsSociogramConfig;
//import morenoapp.model.view.MorenoRespondentPositionSicogrammConfig;
//import morenoapp.model.view.MorenoRespondentsSociogramConfig;
//import morenoapp.model.view.MorenoSociogramConfig;
//import morenoapp.model.view.listeners.MorenoViewChangeListener;
//
///**
// *
// * @author root
// */
//class MorenoSociogramViewProxy implements MorenoSociogramConfig {
//    MorenoSociogramConfig delegate = new MorenoSociogramViewImpl();
//    //
//    MorenoSociogramViewProxy() {
//        super();
//    }
//
//    MorenoSociogramConfig getDelegate() {
//        return delegate;
//    }
//
//    void setDelegate(MorenoSociogramConfig _delegate) {
//        MorenoSociogramConfig oldValue = this.delegate;
//        MorenoSociogramConfig newValue = _delegate;
//        this.delegate = _delegate;
//        fireAllChanged(oldValue, newValue);
//    }
//
//    private void fireAllChanged(MorenoSociogramConfig oldValue, MorenoSociogramConfig newValue) {
//        fireChanges(canvasListeners, MorenoCanvasSociogramConfig.ACCURATE_DRAW, oldValue.isAccurateDraw(), newValue.isAccurateDraw());
//        fireChanges(backgroundListeners, MorenoBackgroundSociogramConfig.RING_STEP, oldValue.getRingStep(), newValue.getRingStep());
//        fireChanges(respondentsListeners, MorenoRespondentsSociogramConfig.DISPLAY_CORRECTIONS, oldValue.isDisplayCorrections(), newValue.isDisplayCorrections());
//        fireChanges(respondentsListeners, MorenoRespondentsSociogramConfig.DISPLAY_METRICS, oldValue.isDisplayMetrics(), newValue.isDisplayMetrics());
//        fireChanges(respondentsListeners, MorenoRespondentsSociogramConfig.DISPLAY_NAMES, oldValue.isDisplayNames(), newValue.isDisplayNames());
//        fireChanges(respondentsListeners, MorenoRespondentsSociogramConfig.DISPLAY_SEX, oldValue.isDisplaySex(), newValue.isDisplaySex());
//        fireChanges(respondentsListeners, MorenoRespondentsSociogramConfig.DISPLAY_TOOLTIPS, oldValue.isDisplayTooltips(), newValue.isDisplayTooltips());
//        fireChanges(respondentsListeners, MorenoRespondentsSociogramConfig.HIDE_FEMALE, oldValue.isHideFemale(), newValue.isHideFemale());
//        fireChanges(respondentsListeners, MorenoRespondentsSociogramConfig.HIDE_MALE, oldValue.isHideMale(), newValue.isHideMale());
//        fireChanges(respondentsListeners, MorenoRespondentsSociogramConfig.HIDE_RESPONDENT, false, true);
//        fireChanges(respondentPositionListeners, MorenoRespondentPositionSicogrammConfig.RESPONDENT_POSITION, new Point(), new Point());
//        fireChanges(relationshipsListeners, MorenoRelationshipsSociogramConfig.DISPLAY_RELATIONSHIPS, false, true);
//        fireChanges(sociogramListeners, MorenoSociogramConfig.VIEW_NAME, oldValue.getViewName(), newValue.getViewName());
//    }
//
//
//    /* begin respondent position */
//    Set<MorenoViewChangeListener> respondentPositionListeners = new HashSet<MorenoViewChangeListener>();
//    public void addRespondentPositionChangeListener(MorenoViewChangeListener lst) {
//        respondentPositionListeners.add(lst);
//    }
//
//    public void removeRespondentPositionChangeListener(MorenoViewChangeListener lst) {
//        respondentPositionListeners.remove(lst);
//    }
//
//    public void setRespondentPosition(MorenoRespondentFace resp, Point2D p) {
//        Point2D oldValue = getRespondentPosition(resp);
//        delegate.setRespondentPosition(resp, p);
//        fireChanges(respondentPositionListeners, RESPONDENT_POSITION, oldValue, new Point2D.Double(p.getX(), p.getY()));
//    }
//
//    public Point2D getRespondentPosition(MorenoRespondentFace resp) {
//        return delegate.getRespondentPosition(resp);
//    }
//    //end respondent position
//
//    /* begin canvas */
//    Set<MorenoViewChangeListener> canvasListeners = new HashSet<MorenoViewChangeListener>();
//    public void addCanvasChangeListener(MorenoViewChangeListener lst) {
//        canvasListeners.add(lst);
//    }
//
//    public void removeCanvasChangeListener(MorenoViewChangeListener lst) {
//        canvasListeners.remove(lst);
//    }
//
//    public void setAccurateDraw(boolean flag) {
//        Boolean oldValue = Boolean.valueOf(delegate.isAccurateDraw());
//        delegate.setAccurateDraw(flag);
//        fireChanges(canvasListeners, ACCURATE_DRAW, oldValue, flag);
//    }
//
//    public boolean isAccurateDraw() {
//        return delegate.isAccurateDraw();
//    }
//    //end canvas
//
//    /* begin background */
//    Set<MorenoViewChangeListener> backgroundListeners = new HashSet<MorenoViewChangeListener>();
//    public void addBackgroudChangeListener(MorenoViewChangeListener lst) {
//        backgroundListeners.add(lst);
//    }
//
//    public void removeBackgroudChangeListener(MorenoViewChangeListener lst) {
//        backgroundListeners.remove(lst);
//    }
//
//    public void setRingStep(int step) {
//        Integer oldValue = Integer.valueOf(delegate.getRingStep());
//        delegate.setRingStep(step);
//        fireChanges(backgroundListeners, RING_STEP, oldValue, step);
//    }
//
//    public int getRingStep() {
//        return delegate.getRingStep();
//    }
//    //end background
//
//    /* begin respondents */
//    Set<MorenoViewChangeListener> respondentsListeners = new HashSet<MorenoViewChangeListener>();
//    public void addRespondentsChangeListener(MorenoViewChangeListener lst) {
//        respondentsListeners.add(lst);
//    }
//
//    public void removeRespondentsChangeListener(MorenoViewChangeListener lst) {
//        respondentsListeners.remove(lst);
//    }
//
//    public void setHideMale(boolean flag) {
//        Boolean oldValue = Boolean.valueOf(delegate.isHideMale());
//        delegate.setHideMale(flag);
//        fireChanges(respondentsListeners, HIDE_MALE, oldValue, flag);
//    }
//
//    public void setHideFemale(boolean flag) {
//        Boolean oldValue = Boolean.valueOf(delegate.isHideFemale());
//        delegate.setHideFemale(flag);
//        fireChanges(respondentsListeners, HIDE_MALE, oldValue, flag);
//    }
//
//    public void setDisplayTooltips(boolean flag) {
//        Boolean oldValue = Boolean.valueOf(delegate.isDisplayTooltips());
//        delegate.setDisplayTooltips(flag);
//        fireChanges(respondentsListeners, DISPLAY_TOOLTIPS, oldValue, flag);
//    }
//
//    public void setDisplaySex(boolean flag) {
//        Boolean oldValue = Boolean.valueOf(delegate.isDisplaySex());
//        delegate.setDisplaySex(flag);
//        fireChanges(respondentsListeners, DISPLAY_SEX, oldValue, flag);
//    }
//
//    public void setDisplayNames(boolean flag) {
//        Boolean oldValue = Boolean.valueOf(delegate.isDisplayNames());
//        delegate.setDisplayNames(flag);
//        fireChanges(respondentsListeners, DISPLAY_NAMES, oldValue, flag);
//    }
//
//    public void setDisplayMetrics(boolean flag) {
//        Boolean oldValue = Boolean.valueOf(delegate.isDisplayMetrics());
//        delegate.setDisplayMetrics(flag);
//        fireChanges(respondentsListeners, DISPLAY_METRICS, oldValue, flag);
//    }
//
//    public void setDisplayCorrections(boolean flag) {
//        Boolean oldValue = Boolean.valueOf(delegate.isDisplayCorrections());
//        delegate.setDisplayCorrections(flag);
//        fireChanges(respondentsListeners, DISPLAY_CORRECTIONS, oldValue, flag);
//    }
//
//    public void setHideRespondent(MorenoRespondentFace resp, boolean flag) {
//        Boolean oldValue = Boolean.valueOf(delegate.isHideRespondent(resp));
//        delegate.setHideRespondent(resp, flag);
//        fireChanges(respondentsListeners, HIDE_RESPONDENT, oldValue, flag);
//    }
//
//    public boolean isHideMale() {
//        return delegate.isHideMale();
//    }
//
//    public boolean isHideFemale() {
//        return delegate.isHideFemale();
//    }
//
//    public boolean isDisplayTooltips() {
//        return delegate.isDisplayTooltips();
//    }
//
//    public boolean isDisplaySex() {
//        return delegate.isDisplaySex();
//    }
//
//    public boolean isDisplayNames() {
//        return delegate.isDisplayNames();
//    }
//
//    public boolean isDisplayCorrections() {
//        return delegate.isDisplayCorrections();
//    }
//
//    public boolean isDisplayMetrics() {
//        return delegate.isDisplayMetrics();
//    }
//
//    public boolean isHideRespondent(MorenoRespondentFace resp) {
//        return delegate.isHideRespondent(resp);
//    }
//    //end respondents
//
//    /*begin relationships*/
//    Set<MorenoViewChangeListener> relationshipsListeners = new HashSet<MorenoViewChangeListener>();
//    public void addRelationshipsChangeListener(MorenoViewChangeListener lst) {
//        relationshipsListeners.add(lst);
//    }
//
//    public void removeRelationshipsChangeListener(MorenoViewChangeListener lst) {
//        relationshipsListeners.remove(lst);
//    }
//
//    public void setDisplayRelationships(MorenoQuestionFace quest, boolean doDisplay) {
//        Boolean oldValue = Boolean.valueOf(delegate.isDisplayRelationships(quest));
//        delegate.setDisplayRelationships(quest, doDisplay);
//        fireChanges(relationshipsListeners, DISPLAY_RELATIONSHIPS, oldValue, doDisplay);
//    }
//
//    public boolean isDisplayRelationships(MorenoQuestionFace quest) {
//        return delegate.isDisplayRelationships(quest);
//    }
//    //end relationships
//
//    /*begin sociogram*/
//    Set<MorenoViewChangeListener> sociogramListeners = new HashSet<MorenoViewChangeListener>();
//    public void addSociogramChangeListener(MorenoViewChangeListener lst) {
//        sociogramListeners.add(lst);
//    }
//
//    public void removeSociogramChangeListener(MorenoViewChangeListener lst) {
//        sociogramListeners.remove(lst);
//    }
//
//    public void setViewName(String name) {
//        String oldValue = delegate.getViewName();
//        delegate.setViewName(name);
//        fireChanges(sociogramListeners, VIEW_NAME, oldValue, name);
//    }
//
//    public String getViewName() {
//        return delegate.getViewName();
//    }
//
//    public void setCurrentView(int index) {
//        delegate.setCurrentView(index);
//        fireAllChanged(delegate, delegate);
//    }
//
//    public int getViewsCount() {
//        return delegate.getViewsCount();
//    }
//
//    public String getViewName(int index) {
//        return delegate.getViewName(index);
//    }
//
//    public int getCurrentView() {
//        return delegate.getCurrentView();
//    }
//
//    public void deleteView(int index) {
//        Integer oldValue = Integer.valueOf(delegate.getViewsCount());
//        delegate.deleteView(index);
//        Integer newValue = Integer.valueOf(delegate.getViewsCount());
//        fireChanges(sociogramListeners, VIEW_COUNT, oldValue, newValue);
//    }
//
//    public void addView(String name, boolean copyFromCurrent) {
//        Integer oldValue = Integer.valueOf(delegate.getViewsCount());
//        delegate.addView(name, copyFromCurrent);
//        Integer newValue = Integer.valueOf(delegate.getViewsCount());
//        fireChanges(sociogramListeners, VIEW_COUNT, oldValue, newValue);
//    }
//
//    //end sociogram
//    protected void fireChanges(Set<MorenoViewChangeListener> listeners, String property, Object oldValue, Object newValue) {
//        for (MorenoViewChangeListener lst : listeners) {
//            lst.onDisplayConfigChanged(property, oldValue, newValue);
//        }
//    }
//
//}
